package com.example.iot.queue.message;

import lombok.Data;

import java.util.UUID;

/**
 * @author ChenXiangpeng
 */
@Data
public class ProtoQueueMsg<T extends SerializeBase> implements QueueMsg {
    private final UUID key;
    protected T value;
    //private final QueueMsgHeaders headers;

    /*public ProtoQueueMsg(UUID key, T value) {
        this(key, value, new DefaultTbQueueMsgHeaders());
    }*/

    public ProtoQueueMsg(UUID key, T value) {
        this.key = key;
        this.value = value;
        //this.headers = headers;
    }

    /*@Override
    public QueueMsgHeaders getHeaders() {
        return this.headers;
    }*/

    public T getValue() {
        return value;
    }

    @Override
    public byte[] getData() {
        return value.serialize();
    }
}
